package com.strato.osgi.scanner.v1_0_0;

import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;

public abstract class AbstractFrameworkBundleListener implements FrameworkBundleListener{
	
	public int getPriority() {
		return PRIORITY_NORMAL;
	}

	public void bindToMonitor(BundleContext bundleContext) {
		ServiceReference<FrameworkBundleMonitor> sr = bundleContext.getServiceReference(FrameworkBundleMonitor.class);
		FrameworkBundleMonitor monitor = bundleContext.getService(sr);
		monitor.addListener(this);
		bundleContext.ungetService(sr);
	}
	
	public void unbindFromMonitor(BundleContext bundleContext){
		ServiceReference<FrameworkBundleMonitor> sr = bundleContext.getServiceReference(FrameworkBundleMonitor.class);
		FrameworkBundleMonitor monitor = bundleContext.getService(sr);
		monitor.removeListener(this);
		bundleContext.ungetService(sr);
	}

	@Override
	public void onInstall(Bundle bundle) {
	}

	@Override
	public void onStart(Bundle bundle) {
	}

	@Override
	public void onStop(Bundle bundle) {
	}

	@Override
	public void onUnresolved(Bundle bundle) {
	}
	
	@Override
	public void onResolve(Bundle bundle) {
	}

	@Override
	public void onStarting(Bundle target) {
	}

	@Override
	public void onStopping(Bundle target) {
	}
	
}
